package cn.gok;

import java.io.*;

public class 缓冲流 {//高级流（基本流加入缓冲区的机制）

    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        BufferedReader bfr = new BufferedReader(new FileReader("E:\\resp1\\day4\\src\\cn\\gok\\a.txt"));
        BufferedWriter bfw = new BufferedWriter(new FileWriter("E:\\resp1\\day4\\src\\cn\\gok\\c.txt"));
        //缓冲读取的时候可以读取行
        String line = "";
        while ((line = bfr.readLine()) != null) {
            bfw.write(line);
            bfw.newLine();//换行
        }
        bfw.close();
        bfr.close();
        long stop = System.currentTimeMillis();//系统时间（毫秒）
        long time = (stop - start) / 1000;
        System.out.println(time);

        //字节缓冲流
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream(""));
        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(""));
        byte bs[]=new byte[100];
        int len=0;
        while((len=bis.read(bs))!=-1){
            bos.write(bs,0,len);
        }
        bos.close();
        bis.close();
    }
}
